<?php
include('../../include/functions.inc.php');
include('../../include/inputbuilder.inc.php');
include('../../include/maintenance.inc.php');
if (isEmpty(getParam('CODE'))) {
    echo 'WRONG PARAMETER';
} else {
    $maintenance = unserialize($_SESSION['mPensum']);
    $list = $db->query_select("cllg_career", NULL);
    $rows = $db->query_select($maintenance->table, sprintf("CODE_RELEASE=%s", sqlValue(getParam('CODE'), "int")));

    foreach ($rows as $row) {
        ?>

        <form id="<?php echo $maintenance->formName; ?>" name="<?php echo $maintenance->formName; ?>" method="POST" action="<?php echo $maintenance->updateUrlPage; ?>">
            <table class=""  width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <th scope="col"><legend>DATOS PENSUM</legend></th>
                    <th scope="col">
                        <legend><div style="margin-left: 30%;margin-top: 1.4%" class="btn-group">
                            <input type="button" name="cmdCursos" class="btn btn-info" value="Personalizar" id="cmdCursos" onclick="javascript:loadLocal('assigncursos.php', Form.serialize('<?php echo $maintenance->formName; ?>'))" value="" />
                            <input type="button" name="cmdOk" class="btn btn-info" id="cmdOk" value="Guardar" onClick="javascript:formOkBt($(this.form),updateAction);jQuery('#cmAddcontainer').show();" />
                            <input type="button" name="eliminar"  class="btn btn-info" id="eliminar" value="Eliminar" onclick="javascript:deleteAction('<?php echo $maintenance->deleteUrlPage; ?>',<?php echo $maintenance->getDeleteUrl(); ?>);jQuery('#cmAddcontainer').show();" value="" />        
                            <input type="button" name="cmdCancel" id="cmdCancel" class="btn btn-info" value="Cancelar" onClick="loadTable();jQuery('#cmAddcontainer').show();" />
                        </div></legend>      
                    </th>
                </tr>

                <td colspan="2"><br/><table width="100%" border="0" cellspacing="0" cellpadding="0">

                        <tr>
                            <td width="20%">CODIGO</td>
                            <td width="80%"><input name="CODE" type="text" readonly="readonly" id="CODE" value="<?php echo $row['CODE_RELEASE']; ?>" /></td>
                        </tr>
                        <tr>
                            <td>CARRERA</td>
                            <td><select name="FK_CAREER" id="FK_CAREER">
                                    <?php foreach ($list as $it) { ?>
                                        <option value="<?php echo $it["ID"]; ?>" 
                                        <?php
                                        if (!(strcmp($it["ID"], $row['FK_CAREER']))) {
                                            echo "selected=\"selected\"";
                                        }
                                        ?>><?php echo $it["NAME"]; ?> </option>
        <?php } ?>
                                </select></td>
                        </tr>
                        <tr>
                            <td>CANTIDAD CICLOS</td>
                            <td><input name="CYCLES" readonly="readonly" type="text" id="CYCLES" value="<?php echo $row['CYCLES']; ?>" />          </td>
                        </tr>
                        <tr>
                            <td>ESTADO</td>
                            <td><select name="STATUS" id="STATUS">
                                    <option value="1" <?php
        if (!(strcmp(1, $row['STATUS']))) {
            echo "selected=\"selected\"";
        }
        ?>>ACTIVO</option>
                                    <option value="0" <?php
                                    if (!(strcmp(0, $row['STATUS']))) {
                                        echo "selected=\"selected\"";
                                    }
                                    ?>>INACTIVO</option>
                                    <option selected="selected" value="" <?php
                                    if (!(strcmp("", $row['STATUS']))) {
                                        echo "selected=\"selected\"";
                                    }
                                    ?>>Seleccione</option>
                                </select>
                            </td>
                        </tr>



                    </table></td>
                </tr>
                <tr>
                    <td colspan="2">&nbsp;</td>
                </tr>
            </table>
        </form>  
        <?php
    }
}
?>
